/*B Module
testB.c文件
实现注册函数
实现事件触发回调*/
#include "test.h"

/* example 1 */
pf_callbakck g_ptrfun;

int Registe_Callback_Fun(Compute_ST *registed_fun)
{
	if(1 != registed_fun->index)
	{
		printf("Registe failed.\n");
		return -1;
	} 
	g_ptrfun = registed_fun->function;
}

void mgmtb_fun(int event)
{
	g_ptrfun(event);
}

/* example 2 */
CODEC_EncodeGetBuffer_CALLBACK g_getEncodeBufCb = NULL;
int CODEC_encSetCallback(CODEC_EncodeGetBuffer_CALLBACK registed_fun)  // get encode Buffer callback function
{
    g_getEncodeBufCb = registed_fun;
    return 0;
}
void CODEC_encGetBuffCall(int encChnId,int encWidth,int encHigh,void *encBuf,int size)
{
    if (g_getEncodeBufCb) {
        g_getEncodeBufCb(encChnId,encWidth,encHigh,encBuf,size);
    }
}


/* example 3 */
SendstrenaCallback mvideoStrenaCb = NULL;
int sdk_register_callback(SendstrenaCallback VideoStreanCb)
{
    if(VideoStreanCb)
    {
        mvideoStrenaCb = VideoStreanCb;
    }

}

void *video_stream_cb(void *param)
{
 //return (void *)0;
    //  if(!param)
        //  return;
     //Pthread_mutex_lock( (char *)__func__,  &stream_write_lock );
    //  sdk_stream_info_t *stream_info = (sdk_stream_info_t *)param;
    //  if( 2 == stream_info->sub_ch)
    //  {
    //      //return;
    //  }
    //  if( 0 == stream_info->sub_ch )
    //  {
    //      //Pthread_mutex_unlock( &stream_write_lock );
    //      //return;
    //  }

}